`timescale 1ns / 1ns
`include "../include/cpu_defines.sv"
// this module will detech interuption and send exccode
module exceptioncontrol(
    input logic [31: 0] aluop,
    input logic [`EXC_CODE_BUS] exccode,
    input logic [`WORD_BUS    ] Cause,
    input logic [`WORD_BUS    ] Status,
    output logic [`EXC_CODE_BUS] cp0_exccode
    //output logic cp0_we

);
always @(*)begin
    if(Status[`STATUS_EXL] == 0 && Status[`STATUS_IE] == 1 
    && (Status[15:8]&Status[15:8]!=8'h00)) begin
        cp0_exccode <= `EXC_INT;
    end
    else begin
        cp0_exccode <=exccode;
    end 
    end
/*always_comb begin
    if(aluop == `ALUOP_MTC0) begin
     cp0_we = 1'b1;
    end

    else begin
    cp0_we = 1'b0;
    end
end*/


endmodule